From bdba59f6f1eb70ad4805f8c27bf812c8175f1a8e Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 25 Sep 2014 08:16:19 -0700 Subject: [PATCH] Update to rust master Also stop denying all warnings and only deny some common warnings. Allow warnings such as deprecation. Closes #634 --- src/cargo/core/package_id.rs | 8 ++++---- src/cargo/lib.rs | 2 +- src/cargo/ops/cargo_rustc/compilation.rs | 2 +- src/cargo/util/process_builder.rs | 2 +- src/cargo/util/profile.rs | 16 ++++++++-------- tests/test_cargo_compile.rs | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/cargo/core/package_id.rs b/src/cargo/core/package_id.rs index 810456c74..da9958184 100644 --- a/src/cargo/core/package_id.rs +++ b/src/cargo/core/package_id.rs @@ -112,13 +112,13 @@ impl Metadata { } } -static central_repo: &'static str = "http://rust-lang.org/central-repo"; +static CENTRAL_REPO: &'static str = "http://rust-lang.org/central-repo"; impl Show for PackageId { fn fmt(&self, f: &mut Formatter) -> fmt::Result { try!(write!(f, "{} v{}", self.name, self.version)); - if self.source_id.to_string().as_slice() != central_repo { + if self.source_id.to_string().as_slice() != CENTRAL_REPO { try!(write!(f, " ({})", self.source_id)); } @@ -128,13 +128,13 @@ impl Show for PackageId { #[cfg(test)] mod tests { - use super::{PackageId, central_repo}; + use super::{PackageId, CENTRAL_REPO}; use core::source::{RegistryKind, SourceId}; use util::ToUrl; #[test] fn invalid_version_handled_nicely() { - let loc = central_repo.to_url().unwrap(); + let loc = CENTRAL_REPO.to_url().unwrap(); let repo = SourceId::new(RegistryKind, loc); assert!(PackageId::new("foo", "1.0", &repo).is_err()); diff --git a/src/cargo/lib.rs b/src/cargo/lib.rs index f3fa578a7..f4d11bab1 100644 --- a/src/cargo/lib.rs +++ b/src/cargo/lib.rs @@ -3,7 +3,7 @@ #![feature(macro_rules, phase)] #![feature(default_type_params)] -#![deny(warnings)] +#![deny(bad_style, unused)] extern crate libc; extern crate regex; diff --git a/src/cargo/ops/cargo_rustc/compilation.rs b/src/cargo/ops/cargo_rustc/compilation.rs index fb135ded0..2e78d0b46 100644 --- a/src/cargo/ops/cargo_rustc/compilation.rs +++ b/src/cargo/ops/cargo_rustc/compilation.rs @@ -91,7 +91,7 @@ fn pre_version_component(v: &Version) -> Option { let mut ret = String::new(); for (i, x) in v.pre.iter().enumerate() { - if i != 0 { ret.push_char('.') }; + if i != 0 { ret.push('.') }; ret.push_str(x.to_string().as_slice()); } diff --git a/src/cargo/util/process_builder.rs b/src/cargo/util/process_builder.rs index 46a020b8f..3a503200c 100644 --- a/src/cargo/util/process_builder.rs +++ b/src/cargo/util/process_builder.rs @@ -111,7 +111,7 @@ impl ProcessBuilder { let program = String::from_utf8_lossy(self.program.as_bytes_no_nul()); let mut program = program.into_string(); for arg in self.args.iter() { - program.push_char(' '); + program.push(' '); let s = String::from_utf8_lossy(arg.as_bytes_no_nul()); program.push_str(s.as_slice()); } diff --git a/src/cargo/util/profile.rs b/src/cargo/util/profile.rs index 20f9070c0..1f56ce306 100644 --- a/src/cargo/util/profile.rs +++ b/src/cargo/util/profile.rs @@ -3,8 +3,8 @@ use std::mem; use std::fmt::Show; use time; -local_data_key!(profile_stack: Vec) -local_data_key!(messages: Vec) +local_data_key!(PROFILE_STACK: Vec) +local_data_key!(MESSAGES: Vec) type Message = (uint, u64, String); @@ -17,9 +17,9 @@ fn enabled() -> bool { os::getenv("CARGO_PROFILE").is_some() } pub fn start(desc: T) -> Profiler { if !enabled() { return Profiler { desc: String::new() } } - let mut stack = profile_stack.replace(None).unwrap_or(Vec::new()); + let mut stack = PROFILE_STACK.replace(None).unwrap_or(Vec::new()); stack.push(time::precise_time_ns()); - profile_stack.replace(Some(stack)); + PROFILE_STACK.replace(Some(stack)); Profiler { desc: desc.to_string(), @@ -30,8 +30,8 @@ impl Drop for Profiler { fn drop(&mut self) { if !enabled() { return } - let mut stack = profile_stack.replace(None).unwrap_or(Vec::new()); - let mut msgs = messages.replace(None).unwrap_or(Vec::new()); + let mut stack = PROFILE_STACK.replace(None).unwrap_or(Vec::new()); + let mut msgs = MESSAGES.replace(None).unwrap_or(Vec::new()); let start = stack.pop().unwrap(); let end = time::precise_time_ns(); @@ -54,9 +54,9 @@ impl Drop for Profiler { print(0, msgs.as_slice()); } else { msgs.push((stack.len(), end - start, msg)); - messages.replace(Some(msgs)); + MESSAGES.replace(Some(msgs)); } - profile_stack.replace(Some(stack)); + PROFILE_STACK.replace(Some(stack)); } } diff --git a/tests/test_cargo_compile.rs b/tests/test_cargo_compile.rs index f84260339..7a9ed2a03 100644 --- a/tests/test_cargo_compile.rs +++ b/tests/test_cargo_compile.rs @@ -161,7 +161,7 @@ test!(cargo_compile_with_warnings_in_the_root_package { assert_that(p.cargo_process("build"), execs() .with_stderr(format!("\ -{filename}:1:14: 1:26 warning: code is never used: `dead`, #[warn(dead_code)] \ +{filename}:1:14: 1:26 warning: function is never used: `dead`, #[warn(dead_code)] \ on by default {filename}:1 fn main() {{}} fn dead() {{}} ^~~~~~~~~~~~ @@ -214,7 +214,7 @@ test!(cargo_compile_with_warnings_in_a_dep_package { COMPILING, p.url(), COMPILING, p.url())) .with_stderr("\ -[..]warning: code is never used: `dead`[..] +[..]warning: function is never used: `dead`[..] [..]fn dead() {} ")); -- 2.30.2